//
//  TupleIteration.swift
//  SwiftUnsafePointer
//
//  Created by edy on 2024/6/3.
//  Copyright © 2024 Riven. All rights reserved.
//

import Foundation

///在结构体utsname中 设备型号machine的定义如下(在OC中是一个char *指针)
//public var machine: (Int8, Int8, Int8, Int8, Int8, Int8, Int8, Int8, Int8, Int8)  = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
public var testTuple1: ((Int, Int, Int), (Int, Int, Int)) = ((1, 2, 3), (9, 8, 7))

// 反射遍历元组
func testTupleIteration() {
    let mirror = Mirror(reflecting: testTuple1)
    mirror.children.forEach { mirrorChild in
        let tMirror = Mirror(reflecting: mirrorChild.value)
        print(mirrorChild.value)

        tMirror.children.forEach({ mirrorChild in
            print(mirrorChild.value)
        })
    }
}
